<?php
/*		if(!$_COOKIE['uid'] || !$_POST['uid'] || $_COOKIE['uid'] !== $_POST['uid']){
			exit('err1');
		}
		$img_uri = $config['upyun_src'];		//图片域名和uri
		//$up = new UpYun();
		//$serviceConfig = new Config('tp-service', 'tpcwre', 'xiaodong123');
		//$up = new Upyun($serviceConfig);
		$img_arr = array();
		foreach ($_FILES as $v) {
			$folder = '/bmxx8/';
			$ext = pathinfo($v['name'],PATHINFO_EXTENSION); //文件后缀
			$file_name = md5(microtime(1).rand(1,9999999)).'.'.$ext;	//拼接文件名
			$path = $folder.$file_name;	//拼接完整上传路径
			$res = $up->write($path,file_get_contents($v['tmp_name']));
			$img_ext = Check_File_Size($v);
			if($res){
				$img_arr[] = $img_uri.$path.$img_ext;
 			}
		}
		if(@$_POST['origin_imgs'] && strlen($_POST['origin_imgs']) > 0){
			foreach(json_decode($_POST['origin_imgs'],1) as $v){
				array_unshift($img_arr,$v);
			}
		}

		if(count($img_arr) > 0){
			$_POST['info_imgs'] = json_encode($img_arr);	//将上传后的图片地址解析成json并存入post数组
		}

		//一：先计算修改后的图片差异，并删除upyun图片实体
		if(@$_POST['origin_imgs2']){
			$img_arr = json_decode($_POST['origin_imgs'],1);	//修改后的图片集合
			$img_arr2 = json_decode($_POST['origin_imgs2'],1);	//修改前的图片集合
			foreach(array_diff($img_arr2,$img_arr) as $v){		//比较差异，选出被丢弃的图片并删除
				$uri = parse_url($v)['path'];		//获取到修改时被删除的原图片uri(目录+文件名)
				preg_match_all('/[^!]*/',$uri, $res);
				$res2 = $up->delete($res[0][0]);
			}
		}

		if(@!$_POST['info_imgs']){		//如果没图片就置空，以便修改bmxx8_info表时不出错
			$_POST['info_imgs']='';
		}

		$pdo = MyPdo::init();

		//unset($_POST['auto_send']);
		unset($_POST['token']);
		unset($_POST['type']);
		unset($_POST['uid']);
		unset($_POST['origin_imgs']);
		unset($_POST['origin_imgs2']);


		//检测指定内容是否匹配关键词表中的关键词
		if(Check_Keywords($pdo,array($_POST['info_title'],$_POST['info_content'],$_POST['info_contacts']))){
			$_POST['info_stat'] = 4;	//匹配到封禁关键字则，状态为4的审核中
		}else{
			$_POST['info_stat'] = 0;	//未匹配到封禁关键字则，状态为0的审核中
		}

		//echo '<pre>';var_dump($_POST);exit;

		//三：修改bmxx8_info表 
		$sql = "update bmxx8_info set info_title=?,info_content=?,info_contacts=?,info_phone=?,info_auto_issue=?,info_imgs=?,info_stat=? where info_id=? and info_uid=?";
		$arr = array($_POST['info_title'],$_POST['info_content'],$_POST['info_contacts'],$_POST['info_phone'],$_POST['info_auto_issue'],$_POST['info_imgs'],$_POST['info_stat'],$_POST['info_id'],$_COOKIE['uid']);
		//echo $sql;
		//dump($arr,1);
		$res = $pdo->dml($sql,$arr);
		if($res > 0){
			echo 'ok';
			//info_id,info_service,info_title,info_issue_time,info_auto_issue,info_stat
			$change_arr = array(
				array(1,$_POST['info_service']),
				array(2,$_POST['info_title']),
				array(4,$_POST['info_auto_issue']),
				array(5,$_POST['info_stat'])
			);

			//修改用户信息列表静态缓存
			Cache_Modify('Cache/User/'.$_COOKIE['uid'],$change_arr,0,$_POST['info_id']);


			$change_detail = array(
				array('3',$_POST['info_title']),
				array('4',$_POST['info_content']),
				array('5',$_POST['info_contacts']),
				array('6',$_POST['info_phone']),
				array('7',$_POST['info_imgs']),
				array('11',$_POST['info_auto_issue'])
			);
			//修改我发布的信息列表静态缓存
			Cache_Modify('Cache/Detail/'.$_POST['info_id'],$change_detail);
			//删除详情静态缓存
			$detail_file = 'Cache/Detail/'.$_POST['info_id'];
			if(file_exists($detail_file)){
				unlink($detail_file);
			}

		}else{
			echo 'err';
		}*/